<style>
    .voteBox { width:98%; height:auto; margin:0 auto;}
    .voteBox li { width:200px; height:auto; float:left; display: inline;}
    .voteBox li a { width:60%; height:15px; line-height:15px; display: block; text-align: center; }
</style>
<?php $data = Addvote_infos::model()->findAll(' aid=:aid ',array(':aid'=>$aid)); ?>
<script type="text/javascript" src="<?php echo ASSETS; ?>/js/addvote.js" ></script>
<p class="config">
    <a class="button" href="javascript:void(0);" onclick="$.vote.addOption('<?php echo CHtml::normalizeUrl(array('upload/index', 'fname' => '/upload/' . $filetemp, 'model' => 6)) ?>','<?php echo ASSETS . 'base/NOIMG.jpg'; ?>');">增加投票项</a>
</p>
<div  >
    <ul class="voteBox" id="voteBox">
        <?php if(!empty($data)):
            foreach($data as $k=>$c){
            ?>
        <li>
            <label>标题</label><input class="text-input larger-input" type="text" name="voteName[]" value="<?php echo $c['votename']; ?>" /><br />
            <label>票数</label><input class="text-input middle-input" type="text" name="voteCount[]" value="<?php echo $c['count']; ?>" />
            <input type="hidden" name="voteid[]" value="<?php echo $c->vid; ?>" />
            
            <img id="vlitS<?php echo $k+1; ?>" class="coverImg" style="margin-top:5px; margin-bottom: 5px;" src="<?php echo (empty($c['litpic']))?ASSETS . 'base/NOIMG.jpg':UPFILE.$filetemp.'/'.$c['litpic']; ?>" />
            <input type="hidden" name="voteLitpic[]" id="vlit<?php echo $k+1; ?>" value="<?php echo $c['litpic']; ?>" />
            <iframe border="no" width="100%" height="60px" src="<?php echo CHtml::normalizeUrl(array('upload/index', 'fname' => '/upload/' . $filetemp,'id'=>$k+1, 'model' => 6)) ?>" ></iframe>
        </li>
        <script type="text/javascript">
        id = '<?php echo $k+1; ?>';    
    </script>
        <?php }else: ?>
        <li>
            <label>标题</label><input class="text-input larger-input" type="text" name="voteName[]" />
            <img id="vlitS1" class="coverImg" style="margin-top:5px; margin-bottom: 5px;" src="<?php echo ASSETS . 'base/NOIMG.jpg'; ?>" />
            <input type="hidden" name="voteid[]" value="0" />
            <input type="hidden" name="voteCount[]" value="0" />
            <input type="hidden" name="voteLitpic[]" id="vlit1" />
            <iframe border="no" width="100%" height="60px" src="<?php echo CHtml::normalizeUrl(array('upload/index', 'fname' => '/upload/' . $filetemp,'id'=>'1', 'model' => 6)) ?>" ></iframe>
        </li>
        <?php endif; ?>
    </ul>
            
</div>
<script type="text/javascript">
function voteLitpic(id,litpic){
         var old = $('#vlit'+id).val();
         
         var path = '/upload/<?php echo $filetemp; ?>/';
         if(old!=''){
         $.ajax({
             type:'post',
             data:'path='+path+old,
             url:'<?php echo CHtml::normalizeUrl(array('channel/deleteCover')); ?>'
         });
         }
         path = path+litpic;
         $('#vlitS'+id).attr('src',path);
         $('#vlit'+id).val(litpic);
}
</script>